<?php 
$servername = "qdm183362191.my3w.com";
$username = "qdm183362191";
$password = "dkl78167816ihcitest";
$sid=$_POST["id"];
$spa=$_POST["password"];
try {
    $conn = new PDO("mysql:host=$servername;dbname=qdm183362191_db", $username, $password);
    $stmt = $conn->query('SELECT user_id,user_password FROM users');
    foreach($stmt as $row) {
        if ($row['user_id']==$sid && $row['user_password']==$spa)
        {
            header("Location:http://qxu1649330205.my3w.com/main.html");
        }
    }
    echo "登录失败<br/>";
    $url = "http://qxu1649330205.my3w.com/logIn.html";  
    echo "<script language='javascript' type='text/javascript'>";  
    echo "window.location.href='$url'";  
    echo "</script>";  
}
catch(PDOException $e)
{
    echo $e->getMessage();
}
$conn=null;
?>